{{extend 'layout.html'}}
<!-- css -->
<style type="text/css">

table, th, td
{
text-align:left;
border: 1px solid black;
}
p
{
text-align:left;
}
#table_content
{
</style>
<!-- end css -->




<p>
{{for s in sorts:}}
[{{=A(s,_href=URL(r=request,args=[category,s,page]))}}]
{{pass}}
{{if page>0:}}[{{=A('prev',_href=URL(r=request,args=[category,sort,page-1]))}}]{{pass}}
{{if page<3 and len(news)>50:}}[{{=A('next',_href=URL(r=request,args=[category,sort,page+1]))}}]{{pass}}
</p>
<table >
{{count =0}}    
{{for k,item in enumerate(news):}}{{if k==50: continue}}
{{count = count + 1}}
{{if k%3 == 0:}}
	<tr width= "100%">
{{pass}}
		<td>
<!-- a table cell for story and rating -->
<table id= "table_content"><tr><td>
	<td>
		<table border="0" cellpadding="0" cellspacing="0">
			<tr><td style="height:10px">{{=A(IMG(_src=URL(r=request,c='static',f='up.png')),_href=URL(r=request,f='vote',args=['up',item.id]))}}</td></tr>
			<tr height="10px"><td class="score">{{=item.score}}</td></tr>
			<tr><td>{{=A(IMG(_src=URL(r=request,c='static',f='down.png')),_href=URL(r=request,f='vote',args=['down',item.id]))}}</td></tr>
		</table>
	</td>
	<td>
		<!-- table for Story --->
		<table>
			<tr>
				<br/>
				<td class="article">
				{{if item.url.strip().lower()=='self':}}
				{{=A(item.title,_href=URL(r=request,f='comments',args=[item.id]))}}
				{{else:}}
				{{=A(item.title,_href=URL(r=request,f='read',args=[item.id]))}}
				{{pass}}
				</td>
			</tr>
			<tr>
				<th>{{="score : "}}{{=item.score}}{{="   "}}{{="    view : "}}{{=item.clicks}}</th>
			</tr>
			<tr>
				<td>{{=item.foreword}}</td>
			</tr>
			<tr><td><i>submitted {{=timesince(item.post_time,now)}} ago by {{=A(item.author_alias,_href=URL(r=request,f='person',args=[item.author]))}}</i>
				</td>
			</tr>
			<tr>
				<td>
				{{=A('%i comments'%item.comments,_href=URL(r=request,f='comments',args=[item.id]))}} {{=A('report',_href=URL(r=request,f='report',args=[item.id]))}} {{if item.author==session.authorized:}} {{=A('delete',_href=URL(r=request,f='delete',args=[item.id]))}} {{pass}}
				</td>
			</tr>
		</table>
	</td>
	</td></tr>
</table>
<!--end a table cell for story and rating-->
		</td>
{{if count%3 == 0:}}
	</tr>
{{pass}}
{{pass}}
</table>